
public class ListOfOperator {

	private Operator [] op;
	private int size;
	private int nbOfOperator;
	
	public ListOfOperator(int size){
		op = new Operator[size];
		this.size = size;
		nbOfOperator = 0;
	}
	 public Operator addOperatorByName (String name) {
         if (getNbOfOperator() < getSize()) {
         	Operator o = new Operator(name);
         	op[getNbOfOperator()] = o;
         	nbOfOperator++;
                         return o;
         }
         else
                 return null;
 }
	 
	 public Operator findOperator(String name){
         for(int i = 0 ; i < getNbOfOperator() ; i++){
                 if(op[i].getName().equals(name)){
                         return op[i] ;
                 }
         }
         return null  ;    
 }
	 
	 public void display(){
   	  if(getNbOfOperator() == 0)
   		  System.out.println("There is no type"); 
   	  else{
       for (int i = 0 ; i < getNbOfOperator() ; i++ )
            op[i].display();
       
   	  }
     } 
	 
	 
	 
	 
	 
	public Operator[] getOp() {
		return op;
	}
	public int getSize() {
		return size;
	}
	public int getNbOfOperator() {
		return nbOfOperator;
	}
	public void setOp(Operator[] op) {
		this.op = op;
	}
	public void setSize(int size) {
		this.size = size;
	}
	
	 
	 
}
